<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopSpaceDesignSoftLogistics extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_space_design_soft_logistics', function (Blueprint $table) {
            $table->id();
            $table->string('orderNo', 64)->default('')->comment('开店订单号');
            $table->string('preparationNo', 64)->default('')->comment('筹备订单号');
            $table->string('sendNo', 64)->default('')->comment('发货订单号');
            $table->unsignedTinyInteger('type')->default(1)->comment('1 大件物流 2快递单号');
            $table->string('productName', 64)->default('')->comment('商品名称');
            $table->string('logisticsName', 64)->default('')->comment('物流联系人');
            $table->string('logisticsNumber',20)->default('')->comment('物流联系电话');
            $table->string('expressName', 64)->default('')->comment('快递公司');
            $table->string('expressEnName', 64)->default('')->comment('快递公司英文');
            $table->string('expressNumber', 64)->default('')->comment('快递单号');
            $table->string('receiverName', 64)->default('')->comment('收货联系人');
            $table->string('receiverNumber',20)->default('')->comment('收货联系电话');
            $table->string('receiverArea', 64)->default('')->comment('收货地区');
            $table->unsignedInteger('provinceCode')->default(0)->comment('省区code');
            $table->unsignedInteger('cityCode')->default(0)->comment('市区code');
            $table->unsignedInteger('areaCode')->default(0)->comment('地区code');
            $table->string('receiverAddress')->default('')->comment('收货详细地址');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除 0 否 1是');
            $table->unsignedTinyInteger('status')->default(2)->comment('物流状态1 未发货 2 已发货 3 运输中 4 已到货 5 已签收 6 已退回');
            $table->unsignedInteger('receiveTime')->default(0)->comment('签收时间');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->index('orderNo', 'idx_orderNo');
            $table->index('preparationNo', 'idx_preparationNo');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '软装物流表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_space_design_soft_logistics');
    }
}
